package cn.qffj.memo.service;

import cn.qffj.memo.domain.TextContent;
import cn.qffj.memo.repository.TextContentRepositroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨友奇
 * @Time 2018/5/5
 */
@Service
public class TextContentService {
    @Autowired
    private TextContentRepositroy textContentRepositroy;

    //通过用户名查询文本
    public List<TextContent> findByUserName(String userName) {
        return textContentRepositroy.findByUserName(userName);
    }

    //通过用户名删除文本
    public void deleteByUserName(String userName) {
        textContentRepositroy.deleteByUserName(userName);
    }

    //通过用户查询是否有写入文字
    public boolean existsByUserName(String userName) {
        return textContentRepositroy.existsByUserName(userName);
    }

    //保存用户数据
    public TextContent save(TextContent textContent) {   return textContentRepositroy.save(textContent);
    }

}
